package com.example.MyThread.CustomThreadPools;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author Jason
 * @PACKAGE_NAME com.example.MyThread.ThreadPool
 * @Description
 * @date 2023-12-11 14:01
 */
public class Demo {
    public static void main(String[] args) throws InterruptedException {
        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                3,//核心线程数量，不能小于0
                6,//最大线程数量，不能小于0，最大数量>=核心线程数量
                60,//空闲线程最大存活时间
                TimeUnit.SECONDS,//存活时间单位，TimeUnit指定
                new ArrayBlockingQueue<>(3),//任务队列
                Executors.defaultThreadFactory(),//创建线程工厂
                new ThreadPoolExecutor.AbortPolicy()//任务的拒绝策略
        );

    }

}
